import request from '@/utils/request'
// 获取员工列表的接口API
export const getEmployeeList = (params) => request({
  method: 'get',
  url: '/sys/user',
  params
})
// 导出员工列表
export const exportEmployee = () => request({
  url: '/sys/user/export',
  responseType: 'blob' // 指定响应的数据类型格式
})

// 导出员工导入模板excel
export const exportTemplate = () => request({
  url: '/sys/user/import/template',
  responseType: 'blob'
})

// 上传员工
export const uploadEmployee = data => request({
  method: 'post',
  url: '/sys/user/import',
  data
})

// 删除员工
export const delEmployee = id => request({
  method: 'delete',
  url: `/sys/user/${id}`
})

// 新增员工
export const addEmployee = data => request({
  method: 'post',
  url: '/sys/user',
  data
})

// 获取员工详情
export const getEmployeeDetail = (id) => request({
  url: `/sys/user/${id}`
})

// 修改员工信息
export const UpdateEmployeeDetail = (data) => request({
  method: 'put',
  url: `/sys/user/${data.id}`,
  data
})

// 为员工分配角色
export const assignRole = data => request({
  method: 'put',
  url: '/sys/user/assignRoles',
  data
})
